package com.livegoods.rabbitmq.dao.impl;

import com.livegoods.pojo.Order;
import com.livegoods.rabbitmq.dao.OrderDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class OrderDaoImpl implements OrderDao {

    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public long insert(Order order) {

        order = mongoTemplate.save(order);

        if(order.getId()!=null){
            return 1;
        }
        return 0;
    }
}
